var t = require("../../@babel/runtime/helpers/defineProperty"),
  a = require("../../res/www.a9a.cn.js"),
  n = getApp(),
  i = wx.getStorageSync("COOK_U");
Page({
  data: {
    uid: "",
    singlePage: !1,
    topbar: [
      { title: "资料", num: 0 },
      { title: "动态", num: 0 },
      { title: "相册", num: 0 },
    ],
    currentTab: 0,
    color: "",
    rgbcolor: "",
    udata: { photo_s: "../../res/img/photo_m.jpg" },
    heights: [],
    div_login: !1,
    mask_class: "alpha0_100",
  },
  topbarFn: function (t) {
    this.setData({ currentTab: t.currentTarget.dataset.idx });
  },
  mainChange: function (t) {
    this.setData({ currentTab: t.detail.current }), this.mainHeight();
  },
  mainHeight: function () {
    var t = this,
      a = [];
    wx.createSelectorQuery()
      .selectAll(".mainHeight")
      .boundingClientRect(function (n) {
        n.forEach(function (t, n) {
          a[n] = t.height;
        }),
          t.setData({ heights: a });
      })
      .exec();
  },
  onLoad: function (t) {
    if (a.ifint(t.uid)) var i = t.uid;
    else {
      var e = decodeURIComponent(t.scene);
      i = (e = e.split("="))[1];
    }
    this.setData({ uid: i }),
      1 != t.share && wx.showLoading({ title: "玩命加载中...", mask: !0 });
    var o = this;
    n.get_config("_ZEAI").then(function (t) {
      o.setData({ color: n._ZEAI.color, rgbcolor: a.c16_rgb(n._ZEAI.color) });
    }),
      n.get_navigationBarTopHeight(this),
      wx.getSystemInfo({
        success: function (t) {
          "singlePage" == t.mode
            ? (o.setData({ singlePage: !0 }), o.init())
            : n.get_openid().then(function (t) {
                o.init();
              });
        },
      });
  },
  init: function () {
    var e = this;
    (i = wx.getStorageSync("COOK_U")),
      n.ajax({
        url: "u.php",
        data: { submitok: "U", uid: e.data.uid, openid: i.openid },
        success: function (n) {
          if (1 == n.flag) {
            var i;
            n.U.nickname;
            var o = 1 == n.U.photo_ifshow ? "" : "blur";
            e.setData(
              ((i = {
                U: n.U,
                HN: n.HN,
                UBBS: n.UBBS,
                MB: n.MB,
                blur: o,
                div_login: !1,
                TREND: n.TREND,
              }),
              t(i, "topbar[1].num", n.TREND.length),
              t(i, "PHOTO", n.PHOTO),
              t(i, "topbar[2].num", n.PHOTO.length),
              t(i, "ios_ifpay", n.ios_ifpay),
              i)
            ),
              wx.setNavigationBarTitle({ title: n.U.nickname });
          } else n.msg, (n.this = e), a.sorry(n);
          e.mainHeight(), wx.hideLoading();
        },
      });
  },
  back: function () {
    1 == this.data.pages.length
      ? wx.exitMiniProgram({ success: function (t) {} })
      : wx.navigateBack();
  },
  bbsFn: function (t) {
    var a = this,
      n = t.currentTarget.dataset.idx2,
      i = t.currentTarget.dataset.id;
    this.setData({
      bbsFormFlag: !0,
      bbs_content: "",
      bbs_form_id: i,
      bbs_form_idx2: n,
    }),
      setTimeout(function () {
        a.setData({ bbs_content_focus: !0 });
      }, 500);
  },
  bbsFormMaskFn: function () {
    this.setData({ bbsFormFlag: !1, bbs_content_focus: !1 });
  },
  bbs_submitFn: function (e) {
    var o = this;
    n.chklogin().then(function (s) {
      s
        ? wx.showModal({
            title: "温馨提醒",
            content:
              "确定提交么？\n以下情形话题将被删除或封号：\n1．请勿留下任何形式联系方法\n2．请勿发表涉黄涉政相关言论\n3．请勿发表辱骂攻击他人言论",
            confirmColor: o.data.color,
            cancelText: "取消",
            confirmText: "确定",
            success: function (s) {
              if (s.confirm) {
                var c = e.currentTarget.dataset.idx2,
                  r = e.currentTarget.dataset.id,
                  u = e.detail.value.bbs_content;
                (i = wx.getStorageSync("COOK_U")),
                  n.ajax({
                    url: "trend.php",
                    data: {
                      submitok: "bbs_add",
                      fid: r,
                      content: u,
                      openid: i.openid,
                    },
                    success: function (n) {
                      if (1 == n.flag) {
                        var i,
                          e = o.data.TREND[c].bbs_arr.length;
                        o.setData(
                          (t(
                            (i = {}),
                            "TREND[" + c + "].bbs_class",
                            n.ARR.bbs_class
                          ),
                          t(
                            i,
                            "TREND[" + c + "].bbs_arr[" + e + "]",
                            n.ARR.bbs_arr
                          ),
                          t(i, "bbsFormFlag", !1),
                          t(i, "bbs_content_focus", !1),
                          i)
                        );
                      } else (n.this = o), (n.url = "no"), a.sorry(n);
                    },
                  });
              }
            },
          })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  agreeFn: function (e) {
    var o = this,
      s = e.currentTarget.dataset.idx2,
      c = e.currentTarget.dataset.id;
    n.chklogin().then(function (e) {
      e
        ? ((i = wx.getStorageSync("COOK_U")),
          n.ajax({
            url: "trend.php",
            data: { submitok: "ajax_agree", tid: c, openid: i.openid },
            success: function (n) {
              if (1 == n.flag) {
                var i,
                  e = o.data.TREND[s].agree_arr.length;
                o.setData(
                  (t((i = {}), "TREND[" + s + "].agreefly", "block"),
                  t(i, "TREND[" + s + "].agree_arr[" + e + "]", {
                    uid: n.uid,
                    photo_s: n.photo_s,
                  }),
                  i)
                );
              } else (n.this = o), (n.url = "no"), a.sorry(n);
            },
          }))
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  vipFn: function () {
    n.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  certFn: function () {
    n.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my/cert" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  dataFn: function () {
    n.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../reg/reg" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  copyuidFn: function (t) {
    var n = t.currentTarget.dataset.uid;
    a.copy_text({ data: n, msg: "ID编号复制成功" });
  },
  bannerFn: function (t) {
    if (!a.empty(this.data.U.photo_ifshow)) {
      var n = t.currentTarget.dataset.cur;
      a.empty(n) ||
        wx.previewImage({ current: n, urls: this.data.U.photolist });
    }
  },
  photo2Fn: function (t) {
    if (!a.empty(this.data.U.photo_ifshow)) {
      var n = t.currentTarget.dataset.cur;
      a.empty(n) || wx.previewImage({ current: n, urls: this.data.PHOTO });
    }
  },
  getPhoneNumber: function (t) {
    n.getPhoneNumber({ e: t, url: "../reg/reg", urlkind: "navigateTo" });
  },
  guessyouFn: function (t) {
    var a = t.currentTarget.dataset.uid;
    wx.redirectTo({ url: "u?uid=" + a });
  },
  zoyqFn: function () {
    n.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../reg/reg?currentTab=2" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  ubbsbtnFn: function () {
    var t = this;
    n.chklogin().then(function (a) {
      a ? t.setData({ div_bbs: !0 }) : wx.navigateTo({ url: "../login/login" });
    });
  },
  div_bbs_submitFn: function (t) {
    var e = this,
      o = t.detail.value;
    n.empty(o.content)
      ? wx.showToast({ title: "请输入评论内容", icon: "none", mask: !0 })
      : wx.showModal({
          title: "",
          content:
            "确定提交么？\r\n以下情形话题将被删除或封号：\r\n《请勿留下任何形式联系方法》\r\n《请勿发表涉黄涉政言论》\r\n《不得辱骂或攻击他人》",
          confirmColor: e.data.color,
          cancelText: "取消",
          confirmText: "确定",
          success: function (t) {
            t.confirm &&
              (wx.showLoading({ title: "正在保存", mask: !0 }),
              n.ajax({
                url: "u.php",
                data: {
                  submitok: "bj_add",
                  openid: i.openid,
                  uid: e.data.uid,
                  content: o.content,
                },
                success: function (t) {
                  wx.hideLoading(),
                    1 == t.flag
                      ? wx.showModal({
                          content: t.msg,
                          confirmColor: e.data.color,
                          confirmText: "朕知道了",
                          showCancel: !1,
                          success: function (t) {
                            e.setData({ div_bbs: !1 }), e.init();
                          },
                        })
                      : ((t.this = e), (t.url = "no"), a.sorry(t));
                },
              }));
          },
        });
  },
  kefu_closeFn: function () {
    this.setData({ div_bbs: !1 });
  },
  zoom9Fn: function (t) {
    var n = t.currentTarget.dataset.cur,
      i = t.currentTarget.dataset.idx2;
    a.empty(n) ||
      wx.previewImage({ current: n, urls: this.data.TREND[i].pic_arr });
  },
  gzFn: function () {
    var e = this;
    n.chklogin().then(function (o) {
      o
        ? ((i = wx.getStorageSync("COOK_U")),
          n.ajax({
            url: "u.php",
            data: { submitok: "ajax_gz", uid: e.data.uid, openid: i.openid },
            success: function (n) {
              1 == n.flag
                ? (e.setData(t({}, "U.gzclass", n.gzclass)),
                  wx.showToast({ title: n.msg, icon: "none", mask: !0 }))
                : ((n.this = e), (n.url = "no"), a.sorry(n));
            },
          }))
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  cert_moreFn: function () {
    wx.navigateTo({ url: "cert_more?uid=" + this.data.uid });
  },
  data_moreFn: function () {
    wx.navigateTo({ url: "data_more?uid=" + this.data.uid });
  },
  hnFn: function () {
    var t = this;
    this.setData({ hn_show: !0, hn_class: "alpha0_100" }),
      n.ajax({
        url: "u.php",
        data: { submitok: "hn", uid: t.data.uid, openid: i.openid },
        success: function (a) {
          1 == a.flag
            ? t.setData({ HN: a.HN })
            : wx.showToast({ title: a.msg, icon: "none", mask: !0 });
        },
      });
  },
  hn_closeFn: function () {
    var t = this;
    this.setData({ hn_class: "alpha100_0" }),
      setTimeout(function () {
        t.setData({ hn_show: !1 });
      }, 500);
  },
  div_hn_btmFn: function () {
    if (this.data.singlePage)
      wx.showModal({
        content: "请点击右下角《前往小程序》",
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (t) {},
      });
    else {
      var t = this;
      n.chklogin().then(function (a) {
        a
          ? t.setData({ div_hn_btm: !0, div_hn_btm_box_class: "div_upAnm1" })
          : wx.navigateTo({ url: "../login/login" });
      });
    }
  },
  div_hn_btm_qxFn: function () {
    var t = this,
      e = this.data.HN.qx_1price_str;
    (e = n.empty(e) ? "" : "\r\n" + e),
      wx.showModal({
        title: "",
        content: "确定委托【" + t.data.HN.hn_truename + "】牵线么？" + e,
        confirmColor: t.data.color,
        cancelText: "我再想想",
        confirmText: "确定",
        success: function (e) {
          e.confirm &&
            n.ajax({
              url: "huxuan.php",
              data: {
                submitok: "div_hn_btm_qx",
                openid: i.openid,
                uid: t.data.uid,
                admid: t.data.HN.hn_id,
              },
              success: function (i) {
                1 == i.flag
                  ? wx.showModal({
                      content: i.msg,
                      confirmColor: t.data.color,
                      confirmText: "朕知道了",
                      showCancel: !1,
                      success: function (t) {
                        wx.navigateBack();
                      },
                    })
                  : "qx_1price" == i.flag
                  ? 1 != t.data.ios_ifpay.flag
                    ? wx.getSystemInfo({
                        success: function (i) {
                          "ios" == i.platform
                            ? wx.showModal({
                                title: "温馨提示",
                                content: t.data.ios_ifpay.tips,
                                confirmColor: t.data.color,
                                cancelText: "返回",
                                confirmText: "联系服务人员",
                                success: function (t) {
                                  t.confirm
                                    ? wx.redirectTo({ url: "../my/hongniang" })
                                    : t.cancel && wx.navigateBack();
                                },
                              })
                            : n.pay({
                                data: {
                                  submitok: "qx_1price",
                                  qx_admid: t.data.HN.hn_id,
                                  qx_uid: t.data.uid,
                                },
                                success: function (a) {
                                  wx.showToast({
                                    title: a.msg,
                                    mask: !0,
                                    duration: 3e3,
                                  }),
                                    setTimeout(function () {
                                      t.init();
                                    }, 3e3);
                                },
                                fail: function (n) {
                                  (n.this = t), (n.url = "no"), a.sorry(n);
                                },
                              });
                        },
                      })
                    : n.pay({
                        data: {
                          submitok: "qx_1price",
                          qx_admid: t.data.HN.hn_id,
                          qx_uid: t.data.uid,
                        },
                        success: function (a) {
                          wx.showToast({
                            title: a.msg,
                            mask: !0,
                            duration: 3e3,
                          }),
                            setTimeout(function () {
                              t.init();
                            }, 3e3);
                        },
                        fail: function (n) {
                          (n.this = t), (n.url = "no"), a.sorry(n);
                        },
                      })
                  : 0 == i.flag
                  ? wx.showModal({
                      content: i.msg,
                      confirmColor: t.data.color,
                      confirmText: "朕知道了",
                      showCancel: !1,
                      success: function (t) {},
                    })
                  : ((i.this = t), (i.url = "no"), a.sorry(i));
              },
            });
        },
      });
  },
  div_hn_btm_closeFn: function () {
    var t = this;
    this.setData({
      mask_class: "alpha100_0",
      div_hn_btm_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        t.setData({
          div_hn_btm: !1,
          mask_class: "alpha0_100",
          div_hn_btm_box_class: "div_upAnm1",
        });
      }, 500);
  },
  telFn: function (t) {
    wx.makePhoneCall({ phoneNumber: this.data.HN.kf_tel });
  },
  onShareAppMessage: function (t) {
    var a = this.data.U.photolist[0],
      n =
        ((a = this.data.U.photo_ifshow ? a : a.replace("_b.jpg", "_blur.jpg")),
        this.data.U);
    return {
      imageUrl: a,
      title:
        (1 == n.sex ? "【帅哥想脱单】" : "【美女想脱单】") +
        n.nickname +
        n.ageheighpay,
      path: "/pages/u/u?uid=" + this.data.uid,
    };
  },
  onShareTimeline: function () {
    var t = this.data.U.photolist[0],
      a =
        ((t = this.data.U.photo_ifshow ? t : t.replace("_b.jpg", "_blur.jpg")),
        this.data.U);
    return {
      imageUrl: t,
      title:
        (1 == a.sex ? "【帅哥想脱单】" : "【美女想脱单】") +
        a.nickname +
        a.ageheighpay,
      query: "uid=" + this.data.uid + "&share=1",
      path: "/pages/u/u",
    };
  },
  contactFn: function () {
    var t = this;
    this.data.singlePage
      ? wx.showModal({
          content: "请点击右下角《前往小程序》",
          confirmText: "朕知道了",
          showCancel: !1,
          success: function (t) {},
        })
      : (a.empty(this.data.MB) || n.openSetting(this.data.MB),
        n.chklogin().then(function (a) {
          a
            ? t.setData({ contact_show: !0, contact_class: "alpha0_100" })
            : wx.navigateTo({ url: "../login/login" });
        }));
  },
  contact_closeFn: function () {
    var t = this;
    this.setData({ contact_class: "alpha100_0" }),
      setTimeout(function () {
        t.setData({ contact_show: !1 });
      }, 500);
  },
  chatFn: function () {
    var t = this;
    n.chklogin().then(function (a) {
      a
        ? wx.navigateTo({ url: "../chat/chat?uid=" + t.data.uid })
        : wx.navigateTo({ url: "../login/login" });
    }),
      this.contact_closeFn();
  },
  loginFn: function () {
    wx.navigateTo({ url: "../login/login" });
  },
  hhFn: function (t) {
    var e = t.currentTarget.dataset.kind,
      o = "weixin" == e ? "微信号" : "手机号",
      s = this;
    n.ajax({
      url: "u.php",
      data: {
        submitok: "ajax_hh_chk",
        kind: e,
        uid: s.data.uid,
        openid: i.openid,
      },
      success: function (t) {
        if (1 == t.flag)
          s.setData({
            HH: t.HH,
            mask_class: "alpha0_100",
            div_hh_box: !0,
            hh_title: o,
            hh_kind: e,
          });
        else if ("no_hh_num" == t.flag)
          s.setData({ mask_class: "alpha0_100", no_hh_num: !0, HH: t.HH });
        else {
          t.msg;
          (t.this = s), a.sorry(t);
        }
      },
    }),
      this.contact_closeFn();
  },
  hh_submitFn: function (t) {
    var e = t.currentTarget.dataset.hh_kind,
      o = t.detail.value.content,
      s = "weixin" == e ? "微信号" : "手机号",
      c = this;
    a.empty(o)
      ? wx.showToast({ title: "请输入【" + s + "】", icon: "none", mask: !0 })
      : "mob" != e || a.ifmob(o)
      ? (this.setData({ div_hh_box: !1, hh_title: s }),
        n.ajax({
          url: "u.php",
          data: {
            submitok: "ajax_hh_update",
            content: o,
            hh_kind: e,
            uid: c.data.uid,
            openid: i.openid,
          },
          success: function (t) {
            1 == t.flag
              ? c.setData({ mask_class: "alpha0_100", div_hh_success: !0 })
              : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          },
        }))
      : wx.showToast({
          title: "请输入正确的【" + s + "】",
          icon: "none",
          mask: !0,
        });
  },
  hhurlFn: function () {
    wx.navigateTo({ url: "../my/hh" });
  },
  mask_closeFn: function (a) {
    var n = this,
      i = a.currentTarget.dataset.maskid;
    "back" == a.currentTarget.dataset.closekind &&
      (this.setData(t({}, i, !1)),
      1 == this.data.pages.length
        ? wx.exitMiniProgram({ success: function (t) {} })
        : wx.navigateBack()),
      this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        var a;
        n.setData((t((a = {}), i, !1), t(a, "mask_class", "alpha0_100"), a));
      }, 400);
  },
  xqkFn: function () {
    var t = this;
    n.chklogin().then(function (a) {
      a
        ? wx.navigateTo({ url: "../my/xqk?uid=" + t.data.uid })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  lawFn: function (t) {
    var a = t.currentTarget.dataset.kind;
    wx.navigateTo({ url: "/pages/about/law?kind=" + a });
  },
  emptyFn: function () {},
  ifagreeFn: function (t) {
    1 == t.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
  privacy_agree: function (t) {
    console.log("agree");
  },
  privacy_disagree: function (t) {
    console.log("disagree"), wx.exitMiniProgram();
  },
});
